# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-httparty
_gemname=${pkgname#ruby-}
pkgver=0.22.0
pkgrel=1
pkgdesc="Makes http fun! Also, makes consuming restful web services dead easy."
url="https://rubygems.org/gems/httparty"
arch="noarch"
license="MIT"
depends="ruby ruby-json ruby-multi_xml ruby-csv ruby-mini_mime"
checkdepends="ruby-rake ruby-bundler ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/jnunemaker/httparty/archive/refs/tags/v$pkgver.tar.gz
	gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
options="!check" #checks depend on cucumber, which is not currently packaged

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake spec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc
}

sha512sums="
b29b6988fc618b17b9c3d82f7450341591bb849191ee973ee6fd0d433bff79c0d95ab180d4edc24b1d7211e0b4d6fd1115ba41605282dbea6c2cea739f7dbf72  ruby-httparty-0.22.0.tar.gz
5a06f64add8180d4cc304da19d5f7a79114db23b0229183643c72cf1b8ce2b3e66cf6a8db597a201ebc7b79d16d7efbb2e4cd1707058cf510d065530a06122ab  gemspec.patch
"
